<?php 
// back page
include_once("../UserIncludes/DbConfig.php");
include_once("../UserIncludes/DataTables.php");

$startTable = '<table align="center" width="90%" border="0" cellpadding="0" cellspacing="0" style="font-family: Arial; font-size: 12px; color: #000000;">';
$endTable = '</table>';

$finalResult='';
$SQL_delete_ad="delete from temp_adgroup_ad where id = '".$_REQUEST['ad_id']."'";
mysql_query($SQL_delete_ad);

 $SQL_total_ads="select * from temp_adgroup_ad";
 $EXE_total_ads=mysql_query($SQL_total_ads);
 $total_ads=mysql_num_rows($EXE_total_ads);

$inner_res = mysql_query("select * from temp_adgroup_ad where form_id = '".$_REQUEST['formId']."'");

if(mysql_num_rows($inner_res)>0)
{
$i=1;
	?>
<?php 
	$rowStr .= '<input type="hidden" name="net_id'.$_REQUEST['fid'].'" id="net_id'.$fffid.'" value='.$_REQUEST['network_id'].'>';

// ........	
// ......................
	$countinner_res =0;
	while($inner_row = mysql_fetch_array($inner_res))
	{
		$countinner_res++;
		$styleBr1  = '';
		if($countinner_res ==mysql_num_rows($inner_res))
		{
			$styleBr1 = 'border-bottom: 2px solid #4dc5d6;';
		}
		$rowStr .= '<tr><td  width="40" height="30" align="center" style=" border-left: 2px solid #4dc5d6; border-right: 2px solid #4dc5d6; border-top: 2px solid #4dc5d6;'.$styleBr1.'">'.$i.'</td><td width="220" align="left" style="border-top: 2px solid #4dc5d6;border-right: 2px solid #4dc5d6;'.$styleBr1.'">'.$inner_row['personal_reference'].'</td> <td width="130" align="left" style="border-top: 2px solid #4dc5d6;'.$styleBr1.'">'.$inner_row['heading'].'</td><td align="left" style=" border-left: 2px solid #4dc5d6; border-right: 2px solid #4dc5d6; border-top: 2px solid #4dc5d6;'.$styleBr1.' padding-left: 5px;" width="40"><a href="javascript:void(0);" onclick=delete_ad('.$inner_row[id].',"'.$_REQUEST['formId'].'")><img alt="delete ad" src="images/delete.jpg" border="0"></a></td></tr>';
		$i++;
	}
	$finalResult = $startTable.$rowStr.$endTable;
	//echo $finalResult;
}

echo $finalResult."@@@".$_REQUEST['formId']."@@@"."Ads: ".$total_ads."^11";
?>